<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="/struts-tags" prefix="s"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ngân hàng đề thi</title>
<s:head />
<style type="text/css">
@import url(media/css/style.css);
</style>
<script type="text/javascript">
function checkAll(id) {
	var item = document.getElementById(id);
	var it = document.getElementsByName("arrayId");
	if (item.checked) {
		for(var i = 0; i < it.length; i++) {
			if (!it[i].checked) {
				it[i].checked = true;
			}
		}
	} else {
		for(var i = 0; i < it.length; i++) {
			if (it[i].checked) {
				it[i].checked = false;
			}
		}
	}
}
</script>
</head>
<body>
<s:actionmessage/>
<s:actionerror/>
<s:if test="listSubQuest.size() > 0">
	<div class="content">
	<table class="userTable" cellpadding="5px">
		<tr class="even">
			<th><input type="checkbox" id="allId" onclick="checkAll(this.id)"/></th>
			<th>Chủ đề</th>
			<th>Ngày tạo</th>
			<th>Ngày cập nhật</th>
			<th>Hành động</th>
		</tr>
		<s:iterator value="listSubQuest" status="userStatus">
			<tr
				class="<s:if test="#userStatus.odd == true ">odd</s:if><s:else>even</s:else>">
				<td>
					<input type="checkbox" name="arrayId" value='<s:property value="examId"/>' onclick="checkBox(this.name)">
					<s:property value="examId"/>
				</td>
				<td><s:property value="subject" /></td>
				<td><s:property value="createDate" /></td>
				<td><s:property value="updateDate" /></td>
				<td colspan="2">
					<s:url id="editURL" action="editSubQuestion">
						<s:param name="subQuestId" value="%{subQuestId}"></s:param>
					</s:url> <s:a href="%{editURL}">Edit</s:a> |
					<s:url id="deleteURL" action="deleteSubQuestion">
						<s:param name="subQuestId" value="%{subQuestId}"></s:param>
					</s:url> <s:a href="%{deleteURL}">Delete</s:a></td>
			</tr>
		</s:iterator>
	</table>
	</div>
</s:if>
<s:a href="addSubQuestion.action">Add SubQuestion</s:a>
<s:a href="../default.action">Home</s:a>
<div id="ids"></div>
</body>
</html>